package _08_blocking_queue.my_implements;


import org.junit.Test;

/**
 * @author: mornd
 * @dateTime: 2023/6/9 - 21:55
 */
public class MyTest2 {

    public static void main(String[] args) {
        DoubleLockArrayBlockingQueue<Integer> queue = new DoubleLockArrayBlockingQueue<>(3);
        queue.offer(0);

        new Thread(() -> {
            try {
                queue.put(1);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }, "t1").start();

        new Thread(() -> {
            try {
                System.out.println(queue.take());
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }, "t2").start();

    }
}
